PoD: Scrub pages before adding to the cache
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Sep 2009 08:08:36 +0000 (09:08 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Sep 2009 08:08:36 +0000 (09:08 +0100)
Neither memory from the allocator nor memory from
the balloon driver is guaranteed to be zero.  Scrub it
before adding to the cache.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/arch/x86/mm/p2m.c

index cc0653fa7ea5043c7586cb7395cba4127559709a..15c6b921be337c106c8af8b90488f3017c508780 100644 (file)
@@ -307,6 +307,17 @@ p2m_pod_cache_add(struct domain *d,
     }
 #endif
 
+    /* Pages from domain_alloc and returned by the balloon driver aren't
+     * guaranteed to be zero; but by reclaiming zero pages, we implicitly promise
+     * to provide zero pages.  So we scrub pages before using */
+    for ( i=0; i< 1 << order ; i++)
+    {
+        char * b;
+        b = map_domain_page(page_to_mfn(page) + i);
+        clear_page(b);
+        unmap_domain_page(b);
+    }
+
     spin_lock(&d->page_alloc_lock);
 
     /* First, take all pages off the domain list */